package com.zzyl.mapper;
import com.github.pagehelper.Page;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NursingProjectMapper {

    /** 
    * @Description: 根据id回显,查询护理项目
    * @Param: [java.lang.Long]
    * @return: com.zzyl.entity.NursingProject
    * @author:fsq 
    * @date: 2024/5/30 20:24
    */
    @Select(("select * from nursing_project where id=#{id}"))
    NursingProject selectById(Long id);

    /** 
    * @Description: 
    * @Param: []
    * @return: java.util.List<com.zzyl.entity.NursingProject>
    * @author:fsq 
    * @date: 2024/5/30 19:46
    */
    @Select("SELECT * FROM nursing_project")
    List<NursingProject> selectAll();

    /** 
    * @Description: 新增护理项目
    * @Param: [com.zzyl.entity.NursingProject]
    * @return: void
    * @author:fsq 
    * @date: 2024/5/29 15:21
    */
    @Insert("INSERT INTO nursing_project(name, order_no, unit, price, image, nursing_requirement, status, create_by, update_by, remark) " +
            "VALUES(#{name}, #{orderNo}, #{unit}, #{price}, #{image}, #{nursingRequirement}, #{status}, #{createBy}, #{updateBy}, #{remark})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(NursingProject nursingProject);

    /** 
    * @Description: 修改护理项目
    * @Param: [com.zzyl.entity.NursingProject]
    * @return: void
    * @author:fsq 
    * @date: 2024/5/29 15:18
    */
    @Update("UPDATE nursing_project SET name = #{name}, order_no = #{orderNo}, unit = #{unit}, price = #{price}, " +
            "image = #{image}, nursing_requirement = #{nursingRequirement}, status = #{status}, " +
            "update_by = #{updateBy}, remark = #{remark} WHERE id = #{id}")
    void update(NursingProject nursingProject);

    /** 
    * @Description: 删除护理项目
    * @Param: [java.lang.Long]
    * @return: void
    * @author:fsq 
    * @date: 2024/5/30 19:45
    */
    @Delete("DELETE FROM nursing_project WHERE id = #{id}")
    void delete(Long id);

    /** 
    * @Description: 条件分页查询护理项目
    * @Param: [java.lang.String, java.lang.Integer]
    * @return: com.github.pagehelper.Page<com.zzyl.entity.NursingProject>
    * @author:fsq 
    * @date: 2024/5/28 12:06
    */
    Page<NursingProjectVo> getByPage(String name, Integer status);
}